#include<iostream>
#include<cstdio>
using namespace std;
int n,l,r;
int main() {
	freopen("candy.in","r",stdin);
	freopen("candy.out","w",stdout);
	cin >> n >> l >> r;
	int v = (r + 1) / n;
	if (v * n > l) cout << n-1;
	else cout << r % n;
	return 0;
}
